import 'package:flutter/material.dart';

class DrawerSample extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("DrawerSample"),
        centerTitle: true,
      ),
      drawer: new Drawer(
        elevation: 16.0,
        child: new ListView(
          children: <Widget>[
            new UserAccountsDrawerHeader(
              accountName: new Text("哈哈哈"),
              accountEmail: new Text("taijinglei@163.com"),
              currentAccountPicture: new CircleAvatar(
                backgroundImage: new AssetImage("images/avator.png"),
              ),
              onDetailsPressed: () {
                print("查看用户信息");
              },
              otherAccountsPictures: <Widget>[
                new Container(
                  child: Image.asset("images/avator.png"),
                )
              ],
            ),
            new ListTile(
              leading: new CircleAvatar(
                child: Icon(Icons.color_lens),
              ),
              title: new Text("我的装扮"),
            ),
            new ListTile(
              leading: new CircleAvatar(
                child: Icon(Icons.photo),
              ),
              title: new Text("我的相册"),
            ),
            new ListTile(
              leading: new CircleAvatar(
                child: new Icon(Icons.wifi),
              ),
              title: new Text("免流量特权"),
            )
          ],
        ),
      ),
      endDrawer: new Drawer(
        elevation: 16.0,
        child: new ListView(
          children: <Widget>[
            new UserAccountsDrawerHeader(
              accountName: new Text("哈哈哈"),
              accountEmail: new Text("taijinglei@163.com"),
              currentAccountPicture: new CircleAvatar(
                backgroundImage: new AssetImage("images/avator.png"),
              ),
              onDetailsPressed: () {
                print("查看用户信息");
              },
              otherAccountsPictures: <Widget>[
                new Container(
                  child: Image.asset("images/avator.png"),
                )
              ],
            ),
            new ListTile(
              leading: new CircleAvatar(
                child: Icon(Icons.color_lens),
              ),
              title: new Text("我的装扮"),
            ),
            new ListTile(
              leading: new CircleAvatar(
                child: Icon(Icons.photo),
              ),
              title: new Text("我的相册"),
            ),
            new ListTile(
              leading: new CircleAvatar(
                child: new Icon(Icons.wifi),
              ),
              title: new Text("免流量特权"),
            )
          ],
        ),
      ),
      body: new Builder(builder: (BuildContext context) {
        return Center(
          child: FlatButton(
              onPressed: () {
                Scaffold.of(context).showSnackBar(SnackBar(
                  content: Text("点击了那个删除"),
                  duration: Duration(seconds: 2),
                  backgroundColor: Colors.brown,
                ));
              },
              child: Text("出来")),
        );
      }),
    );
  }
}
